package com.dalao.root.system.entity;

public class Result {
    /**
     * 请求状态
     */
    private Status status;

    /**
     * 请求结果
     */
    private String result;

    /**
     * 请求消息
     */
    private String message;

    /**
     * 请求返回数据
     */
    private Object data;

    /**
     * 数据类型
     */
    private String type;

    public void success(String message){
        setMessage(message);
        setResult("success");
    }

    public void success(){
        setMessage("操作成功");
        setResult("success");
    }

    public void fail(String message){
        setMessage(message);
        setResult("fail");
    }

    public void fail(){
        setMessage("操作失败");
        setResult("fail");
    }

    public Status getStatus() {
        return status;
    }

    public void setStatus(Status status) {
        this.status = status;
    }

    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public enum Status{
        SUCCESS("success"),FAIL("fail"),ERROR("error");
        private String value = "success";

        private Status(String s){
            this.value = s;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }
    }
}
